﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;

namespace CRMClient.Views.AccountViews
{
    public partial class DetailsAccount : PhoneApplicationPage
    {
        public DetailsAccount()
        {
            InitializeComponent();
            DataContext = App.AccountViewModel;
        }

        private void appBarUpdateButton_Click(object sender, EventArgs e)
        {
            string destination = "/Views/AccountViews/UpdateAccount.xaml";
            NavigationService.Navigate(new Uri(destination, UriKind.RelativeOrAbsolute));
        }

        private void appBarDeleteButton_Click(object sender, EventArgs e)
        {
            MessageBoxResult result = MessageBox.Show("Current account will be deleted","Delete account",MessageBoxButton.OKCancel);
            if (result.Equals(MessageBoxResult.OK))
            {
                App.AccountViewModel.del();
                if (NavigationService.CanGoBack)
                {
                    NavigationService.GoBack();
                }
            }
        }

    }
}